package com.vnt.common;

import java.io.Serializable;

public class Result<T> implements Serializable {
    private String status;
    private String msg;
    private T data;

    public String getstatus() { return status; }

    public void setstatus(String status) { this.status = status; }

    public String getMsg() { return msg; }

    public void setMsg(String msg) { this.msg = msg; }

    public Result(String status, String msg, T data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public T getData() { return data; }

    public void setData(T data) { this.data = data; }

    public Result() {
    }

    public Result(T data) {
        this.data = data;
    }

    public static Result success(){
        Result result=new Result<>();
        result.setstatus("0");
        result.setMsg("成功");
        return result;
    }
    public static <T> Result<T> success(T data){
        Result<T> result=new Result<>(data);
        result.setstatus("0");
        result.setMsg("成功");
        return result;
    }

    public static Result error(String status, String msg){
        Result result=new Result();
        result.setstatus(status);
        result.setMsg(msg);
        return result;
    }

}
